<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./../template.xhtml">

            <ui:define name="title">
                Event Page
            </ui:define>

            <ui:define name="content">
                <h:form>
                    <p:panel id="panel" header="UserDetail">
                        <p:panelGrid>
                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        User ID :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <h:outputText value="#{userController.selected.userID}" id="txtuserID" styleClass="art-blockcontent-body">
                                        </h:outputText>
                                    </h4>
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        User Name :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:inputText id="txtUsername" value="#{userController.selected.userName}" styleClass="art-blockcontent-body"
                                                     title="User Name" required="true"
                                                     requiredMessage="FullName field is required."
                                                     >
                                        </p:inputText>
                                    </h4>
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        Gender :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:selectOneRadio id="options" value="#{userController.selected.gender}">
                                            <f:selectItem itemLabel="Male" itemValue="true"/>
                                            <f:selectItem itemLabel="Female" itemValue="false" />
                                        </p:selectOneRadio>
                                    </h4>
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        birthDay :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:calendar value="#{userController.selected.birthDay}" id="Birthday" required="true"
                                                    navigator="true" effect="explode"> <f:convertDateTime pattern="dd/MM/yyyy" />
                                        </p:calendar>
                                    </h4>
                                </p:column>
                            </p:row>
                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        Email :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:inputText id="email" value="#{userController.email2}" styleClass="art-blockcontent-body"
                                                     validatorMessage="Email is not mach!" maxlength="50" requiredMessage="Length of Email must not more 50 characters">
                                            <f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
                                        </p:inputText>
                                        
                                    </h4>
                                </p:column>
                            </p:row>
                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        Address :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:inputTextarea value="#{userController.selected.addressInfo}" autoResize="false"
                                                         styleClass="art-blockcontent-body" style="width: 180px" maxlength="200"
                                                         requiredMessage="Length of address must between 0-200 characters">
                                        </p:inputTextarea>
                                    </h4>
                                </p:column>
                            </p:row>
                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        Phone Number :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:inputText value="#{userController.selected.phoneNumber}" styleClass="art-blockcontent-body"
                                                     maxlength="20" requiredMessage="Length of Phone number must between 0-20 characters">
                                        </p:inputText>
                                    </h4>
                                </p:column>
                            </p:row>
                            <p:row>
                                <p:column>
                                    <p:commandButton image="ui-icon ui-icon-pencil" action="#{userController.update}" value="Update" ajax="false" style="width: 80px; height: 30px"/>
                                </p:column>
                                <p:column>
                                    <p:commandButton value="Cancel" immediate="true" action="#{userController.cancelEditEvent}" style="width: 80px; height: 30px"/>
                                </p:column>
                            </p:row>
                        </p:panelGrid>
                    </p:panel>

                </h:form>

            </ui:define>

        </ui:composition>

    </body>
</html>
